/**
 * 2319. 判断矩阵是否是一个 X 矩阵
 * @param {number[][]} grid
 * @return {boolean}
 */
var checkXMatrix = function (grid) {
	const n = grid.length
	for (let i = 0; i < n; i++) {
		for (let j = 0; j < n; j++) {
			if (i === j || i + j === n - 1) {
				if (grid[i][j] === 0) return false
			} else if (grid[i][j] !== 0) return false
		}
	}
	return true
}

const res = checkXMatrix([
	[5, 7, 0],
	[0, 3, 1],
	[0, 5, 0],
])
console.log('checkXMatrix :>>', res)
